Skip to content

주사위 굴리기 / 경사로#148

Open
sangYuLv wants to merge 2 commits intomainfrom
liv
Open

주사위 굴리기 / 경사로#148
sangYuLv wants to merge 2 commits intomainfrom
liv

Conversation

@sangYuLv
Copy link
Copy Markdown
Collaborator

🔗 문제 링크

🔗 문제 링크

@sangYuLv sangYuLv self-assigned this Apr 25, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements solutions for two Baekjoon problems: 'Dice Rolling' (14499) and 'Slope' (14890) using Swift. The code changes include logic for simulating dice movements on a grid and validating paths with slopes. The review feedback suggests improving code readability by splitting multiple variable declarations into separate lines and utilizing the map function to extract column data from 2D arrays more concisely.

// 백준 - 14499 주사위 굴리기

let line = readLine()!.split(separator: " ").compactMap { Int($0) }
let n = line[0]; let m = line[1]; let x = line[2]; let y = line[3]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

한 줄에 세미콜론(;)을 사용하여 여러 변수를 선언하는 것은 가독성을 떨어뜨립니다. Swift 스타일 가이드에 따라 각 선언을 별도의 줄로 분리하는 것이 좋습니다.

Suggested change
let n = line[0]; let m = line[1]; let x = line[2]; let y = line[3]
let n = line[0]
let m = line[1]
let x = line[2]
let y = line[3]

// 백준 - 14890 경사로

let nl = readLine()!.split(separator: " ").compactMap { Int($0) }
let n = nl[0]; let l = nl[1]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

가독성을 위해 한 줄에 여러 문장을 작성하는 대신 줄바꿈을 사용하여 선언을 분리하는 것이 좋습니다.

Suggested change
let n = nl[0]; let l = nl[1]
let n = nl[0]
let l = nl[1]

Comment on lines +14 to +15
var column = [Int]()
for row in map { column.append(row[i]) }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

반복문을 사용하여 열(column) 데이터를 수동으로 추출하는 대신, map 함수를 사용하면 더 간결하고 Swift다운 코드를 작성할 수 있습니다.

Suggested change
var column = [Int]()
for row in map { column.append(row[i]) }
let column = map.map { $0[i] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant